#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
const int N = 1e6+5;
const ll mod = 998244353;

ll fastpow(ll a, ll n) {
    ll res = 1;
    a %= mod;
    while(n) {
        if(n & 1) {
            res = (res * a) % mod;
        }
        n >>= 1;
        a = (a * a) % mod;
    }
    return res;
}

ll ni(ll a) {
    return fastpow(a, mod - 2);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n;
    cin >> n;
    ll len = to_string(n).length();
    ll base = fastpow(10, len);
    
    ll fenzi = (fastpow(base, n) - 1 + mod) % mod;
    ll fenmu  = (base - 1) % mod;
    ll sum;
    
    if (fenmu  == 0) {
        sum = n % mod;
    } else {
        ll inv_fenmu  = ni(fenmu );
        sum = (fenzi * inv_fenmu ) % mod;
    }
    
    ll ans = (n % mod) * sum % mod;
    cout << ans << endl;

    return 0;
}